<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        #frame{
            float:center;
            margin-top:50px;
        }
        #inner{
            width:440px;
            height:260px;
            margin-left:530px;
            margin-top:50px;
        }
        a{
            text-decoration: none;
        }
        .bt{
            width:240px;
            height:60px;
            line-height: 60px;
            color:blue;
            font-size:25px;
            margin-top:50px;
            background:#333;
            border-radius:50px;
            font-family:KaiTi;
        }

    </style>
</head>
<body>
<%
    session.removeAttribute("currentBook");
	session.removeAttribute("user");
	session.removeAttribute("currentUser");
	session.removeAttribute("currentBorrow");
%>
<div id="frame" align="center">
    <img src="image/7.jpg" width=640px height=640px >
</div>
<div id="inner" align="center" >
    <form action="/login" method="post">
        用户名：<input type="text" name="userName" id="u_id"><br><br>
        密_码：<input type="password" name="password" id="u_pwd"><br>
        验证码: <input type="text" name="verCode" id="u_code"> <span style="display: inline-block;vertical-align: middle"><img src="/captcha" width="130px" height="48px" id="code_img"/></span>
        <button type="submit" class="bt" id="bts"  align="center">登录</button>
        <a href="/register.jsp" style="display: block" class="bt" align="center" >注册</a>
    </form>
</div>

</body>
<script>
    let btn1 = document.getElementById("bts");
    btn1.onclick=function () {
        let id_str=document.getElementById("u_id").value;
        if(id_str===null||id_str===""){
            alert("请输入用户名");
            return;
        }
        let pwd_str=document.getElementById("u_pwd").value;
        if(pwd_str===null||pwd_str===""){
            alert("请输入密码");
            return;
        }
        let code_str=document.getElementById("u_code").value;
        if(code_str===null||code_str===""){
            alert("请输入验证码");
            return;
        }
    }
    let code = document.getElementById("code_img");
    code.onclick = function (){
        code.src = "/captcha?time=" + new Date();
    }
</script>
</html>
